<body>
<p>Test that worker object is not garbage collected if there is a message from
worker context. Should print "SUCCESS".
<a href="https://bugs.webkit.org/show_bug.cgi?id=62446">Bug 62446</a></p>
<div id=result></div>
<script src="../../resources/gc.js"></script>
<script>
function log(message)
{
    document.getElementById("result").innerHTML += message + "<br>";
}

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var interval = setInterval(gc, 0);

var worker = new Worker('resources/worker-init.js');
worker.onmessage = function(evt) {
    log(evt.data);
    clearInterval(interval);
    if (window.testRunner)
        testRunner.notifyDone();
}
worker = 0;
gc();
</script>
</body>
</html>
